package com.aaa.springboot_mp_vue.util;

import lombok.Data;

@Data
public class Result<T> {

    /**
     * code 0
     */
    private Integer code ;
    private String msg ;
    private T t;

    public static <T> Result ok(T t){
        return new Result(t);
    }
    public static <T> Result ok(){
        return new Result();
    }

    public static <T> Result fail(Integer code){
        return new Result(code);
    }

    public Result(Integer code) {
        this.code = code;
        this.msg = "操作失败";

    }

    public Result(T t) {
        this.code = 200;
        this.msg = "操作成功";
        this.t = t;
    }

    public Result() {
        this.code = 200;
        this.msg = "操作成功";
    }
}

